package com.android.likeweixin;

import java.util.List;

import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;

public class ViewPagerAdapter extends PagerAdapter {

	private List<View> pageViews;

	public ViewPagerAdapter(List<View> pageViews) {
		this.pageViews = pageViews;
	}

	@Override
	public Object instantiateItem(View container, int position) {
		((ViewPager) container).addView(pageViews.get(position));
		return pageViews.get(position);
	}

	@Override
	public void destroyItem(View container, int position, Object object) {

		((ViewPager) container).removeView(pageViews.get(position));
	}

	@Override
	public int getCount() {
		if (pageViews != null) {
			return pageViews.size();
		}
		return 0;
	}

	@Override
	public int getItemPosition(Object object) {
		return super.getItemPosition(object);
	}

	@Override
	public boolean isViewFromObject(View container, Object object) {
		return container == ((View) object);
	}

	@Override
	public void restoreState(Parcelable arg0, ClassLoader arg1) {

	}

	@Override
	public Parcelable saveState() {
		return null;
	}

	@Override
	public void startUpdate(View arg0) {

	}

	@Override
	public void finishUpdate(View arg0) {

	}
}
